<template>
    <div class="bg-white mt-[10px]">
        <BaseHead> 论文信息</BaseHead>
        <div class="p-[10px] w-10/12 mx-auto">
            <el-descriptions title="" :column="2" border label-width="140">
                <el-descriptions-item label-class-name="gdlable" label="名称">{{
                xmInfo.name
            }}</el-descriptions-item>
                <el-descriptions-item label-class-name="gdlable" label="发表/出版时间">{{
                    dateFormatter3(xmInfo.publishDate)
                }}</el-descriptions-item>
                <el-descriptions-item label-class-name="gdlable" label="所有作者"> <span type="primary"
                        v-for="(item, index) in xmInfo.authorList" :key="item.paperId">{{ item.authorName
                        }}<span v-if="index + 1 != xmInfo.authorList.length">,</span></span></el-descriptions-item>
                <el-descriptions-item label-class-name="gdlable" label="发表/刊物论文集">{{
                xmInfo.magazineName
            }}</el-descriptions-item>
            </el-descriptions>
        </div>
    </div>
    <div class="bg-white mt-[10px]">
        <BaseHead> 收录信息</BaseHead>
        <div class="p-[10px] w-10/12 mx-auto">
            <el-table :data="slTable" border style="width: 100%">
                <el-table-column prop="embodyTypeId" label="收录类型" :formatter="formatterembodyTypeId" />
                <el-table-column prop="embodyDate" label="收录日期" :formatter="dateFormatter2" />
                <el-table-column prop="factor" label="影响因子" />
                <el-table-column prop="sciPartition" label="大类分区"> <template #default="scope">
                        {{ scope.row.sciPartition == '1' ? '一区'
                : scope.row.sciPartition == '2' ? '二区'
                    : scope.row.sciPartition == '3' ? '三区'
                        : scope.row.sciPartition == '4' ? '四区'
                            : '' }}
                    </template></el-table-column>
                <el-table-column prop="feeAuthorize" label="收录证明附件">
                    <template #default="scope">
                        <div v-for="item in scope.row.fileList" :key="item.id">{{ item.fileName
                            }}<el-link type="primary" style="margin-left: 8px;"
                                @click="downloadMet(item.id)">下载</el-link>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>
<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import { getpaperInfo, getaddPaperInclude, getpaperIncludeInfo, getlevelList, delPaperInclude, geteditPaperInclude } from "@/api/achievement/kycg"
import { ElMessage, ElMessageBox } from "element-plus";
const props = defineProps({
    productId: String,
})
const xmInfo = ref({})
const slTable = ref([])
const viewXm = () => {
    getpaperInfo(props.productId).then((res) => {
        if (res.code == 200) {
            xmInfo.value = res.data
        }
    })
    getslTable()
};
const getslTable = () => {
    getpaperIncludeInfo(props.productId).then((res) => {
        if (res.code == 200) {
            slTable.value = res.data
        }
    })
}
const formatterembodyTypeId = (row, column, cellValue, index) => {
    if (lbList.value.length && cellValue) {
        if (lbList.value.find(item => item.code == cellValue)) {
            return lbList.value.find(item => item.code == cellValue).name
        } else {
            return ''
        }

    } else {
        return ''
    }
}
const lbList = ref([])
const { proxy } = getCurrentInstance();
const downloadMet = (i) => {
    proxy.$download.common(i)
}

const getslList = async () => {
    let parms = {
        pageNum: 1,
        pageSize: 100
    }
    let res = await getlevelList(parms)
    if (res.code == 200) {
        lbList.value = res.rows.filter(item => {
            return item.isEmbody == '1'
        })
    }
}
getslList()
viewXm()
</script>
<style scoped lang="scss">
@import url("@/views/achievement/index.scss");
</style>
<style lang="scss">
.slDig {
    padding: 0;
    background-color: #f0f2f5;
    height: 70vh !important;
    overflow-y: hidden;
    margin-top: 25vh !important;

    .el-dialog__body {
        height: 82%;
        overflow: auto;
        padding-bottom: 55px;
    }

}

.slDig:not(.is-fullscreen) {
    margin-top: 15vh !important;
}
</style>